package com.langfeiyes.pattern.proxy.dynamic.cglib;



public class App {
    public static void main(String[] args) {

        System.out.println("----------------真实对象--------------------");

        EmployeeServiceImpl employeeService = new EmployeeServiceImpl();
        employeeService.list();
        employeeService.save();

        System.out.println("----------------代理对象--------------------");
        SessionHolder.setCurrentUser("admin");  //设置权限(当前登录用户)
        EmployeeMethodInterceptor interceptor = new EmployeeMethodInterceptor(employeeService);
        EmployeeServiceImpl proxy = (EmployeeServiceImpl) interceptor.getProxy();
        proxy.list();
        proxy.save();
    }
}
